﻿using UnityEngine;

public class BaseMono : MonoScript
{
	[HideInInspector]
	public bool IsInit = false;
	[HideInInspector]
	public bool IsPause = false;

	[HideInInspector]
	public Transform MyTrans;

	public virtual void onAwake() { }
	public virtual void onStart() { }
	public virtual void onFixedUpdate() { }
	public virtual void onUpdate() { }
	public virtual void onLateUpdate() { }
	public virtual void onEnable() { }
	public virtual void onDisable() { }
	public virtual void onDestroy() { }

	public virtual void Init()
	{
		IsInit = true;
	}


	sealed public override void Awake()
	{
		MyTrans = transform;

		onAwake();
	}

	sealed public override void Start()
	{
		onStart();
	}

	sealed public override void FixedUpdate()
	{
		if (IsInit && !IsPause)
		{
			onFixedUpdate();
		}
	}

	sealed public override void Update()
	{
		if (IsInit && !IsPause)
		{
			onUpdate();
		}
	}

	sealed public override void LateUpdate()
	{
		if (IsInit && !IsPause)
		{
			onLateUpdate();
		}
	}

	sealed public override void OnEnable() {
		onEnable();
	}

	sealed public override void OnDisable()
	{
		onDisable();
	}

	sealed public override void OnDestroy()
	{
		onDestroy();
	}
}

public interface IMono {
	void onAwake();
	void onStart();
	void onEnable();
	void onFixedUpdate();
	void onUpdate();
	void onLateUpdate();
	void onDisable();
	void onDestroy();
}

public interface IModule
{
	void Init();
	void Excute();
	void Clear();
	void Reset();
}